package controller.UserTable;

import entity.MsgResult;
import entity.user;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.DeleteUserService;

@Controller
public class DeleteUserController {

    @Autowired
    private DeleteUserService deleteUserService;

    @RequestMapping("/deleteUser")
    @ResponseBody
    public MsgResult deteleUser(user user){
        MsgResult msgResult = new MsgResult();
        boolean b = deleteUserService.deleteUser(user.getUserId());
        if(b){
            msgResult.setFlag(1);
            msgResult.setMsg("删除用户成功");
            return msgResult;
        }
        msgResult.setFlag(0);
        msgResult.setMsg("删除用户失败");
        return msgResult;
    }
}
